import dataQueryApi from '@/api/modules/data.query'

export function useErrHook(produceData: any, startTime: any, endTime: any) {
  const ReuseTotals = ref<any>([])
  const ProduceTotals = ref<any>([])
  const Items = ref<any>([])

  function getErrorData() {
    // 清空数组
    return dataQueryApi.GetReuseEx({
      objIDs: [unref(produceData).ObjID],
      startTime: unref(startTime),
      endTime: unref(endTime),
    }).then(
      (res: any) => {
        ReuseTotals.value = res.ReuseTotals
        ProduceTotals.value = res.ProduceTotals
        Items.value = res.Items
      },
    )
  }

  return { ReuseTotals, getErrorData, ProduceTotals, Items }
}
